<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div1 {
            width: 200px;
            height: 200px;
            background: blue;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .div1>:first-child {
            width: 50px;
            height: 50px;
            background: orange;
        }

        .div2 {
            width: 200px;
            height: 200px;
            background: blue;
            display: flex;
            justify-content: flex-end;
            align-items: center;
        }

        .div2>:first-child {
            width: 50px;
            height: 50px;
            background: orange;
        }

        .div3 {
            width: 200px;
            height: 200px;
            background: blue;
            display: flex;
            justify-content: space-around;
            align-items: center;
        }

        .div3 div {
            width: 50px;
            height: 50px;
            background: orange;
        }

        .div4 {
            width: 200px;
            height: 200px;
            background: blue;
            display: flex;
            align-content: space-around;
            flex-wrap: wrap
        }

        .div4>div {
            width: 200px;
            display: inline-flex;
            justify-content: space-between;
        }

        .div4>div>div {
            width: 50px;
            height: 50px;
            background: orange;
        }
    </style>
</head>

<body>
    <p>单个盒子的水平、垂直均居中</p>
    <div class="div1">
        <div></div>
    </div>
    <p>单个盒子水平居右 垂直居中</p>
    <div class="div2">
        <div></div>
    </div>
    <p>一排盒子的水平垂直居中</p>
    <div class="div3">
        <div></div>
        <div></div>
        <div></div>
    </div>
    <p>多排盒子的水平垂直居中</p>
    <div class="div4">
        <div>
            <div></div>
            <div></div>
            <div></div>
        </div>
        <div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</body>

</html>